package com.cdcas;

import java.lang.ref.Cleaner;

public class CleanerThread implements AutoCloseable{

    private  static final Cleaner clean = Cleaner.create();
    private Cleaner.Cleanable cleanable;
    public CleanerThread(Book book) {
        this.cleanable = clean.register(this,book);
    }

    @Override
    public void close() throws Exception {
        this.cleanable.clean();
    }

}
